
import { createRouter, createWebHistory } from 'vue-router'
// 路由规则
const routes = [
    {
        path: "/index",
        name: "index",
        meta: {
            title: "首页",
        },
        component: () => import("../views/welcome.vue")
    },
    {
        path: "/sys",
        name: "sys",
        meta: {
            title: "系统管理",
        },
        icon: "<el-icon><Histogram /></el-icon>",
        children: [
            {
                path: "/dict",
                name: "dict",
                meta: {
                    title: "字典管理",
                },
                component: () => import('../views/sys/dict/list.vue')
            },
            {
                path: "/log",
                name: "log",
                meta: {
                    title: "操作日志管理",
                },
                component: () => import('../views/sys/log/list.vue')
            }
        ]
    }, {
        path: "/organizational",
        name: "organizational",
        meta: {
            title: "组织架构",
        },
        icon: "<el-icon><UserFilled /></el-icon>",
        children: [
            {
                path: "/dept",
                name: "dept",
                meta: {
                    title: "部门管理",
                },
                component: () => import('../views/organizational/dept/list.vue')
            },
            {
                path: "/post",
                name: "post",
                meta: {
                    title: "岗位管理",
                },
                component: () => import('../views/organizational/post/list.vue')
            },
            {
                path: "/role",
                name: "role",
                meta: {
                    title: "角色管理",
                },
                component: () => import('../views/organizational/role/list.vue')
            },
            {
                path: "/user",
                name: "user",
                meta: {
                    title: "用户管理",
                },
                component: () => import('../views/organizational/user/list.vue')
            }
        ]
    },
    {
        path: "/maindata",
        name: "maindata",
        meta: {
            title: "主数据",
        },
        icon: "<el-icon><Files /></el-icon>",
        children: [
            {
                path: "/item-category",
                name: "item-category",
                meta: {
                    title: "物料分类",
                },
                component: () => import('../views/main-data/item-category/list.vue')
            },
            {
                path: "/item",
                name: "item",
                meta: {
                    title: "物料管理",
                },
                component: () => import('../views/main-data/item/list.vue')
            },
            {
                path: "/unit",
                name: "unit",
                meta: {
                    title: "计量单位",
                },
                component: () => import('../views/main-data/unit/list.vue')
            },
            {
                path: "/customer",
                name: "customer",
                meta: {
                    title: "客户管理",
                },
                component: () => import('../views/main-data/customer/list.vue')
            },
            {
                path: "/supplier",
                name: "supplier",
                meta: {
                    title: "供应商管理",
                },
                component: () => import('../views/main-data/supplier/list.vue')
            },
            {
                path: "/workshop",
                name: "workshop",
                meta: {
                    title: "车间设置",
                },
                component: () => import('../views/main-data/workshop/list.vue')
            },
            {
                path: "/workstation",
                name: "workstation",
                meta: {
                    title: "工作站",
                },
                component: () => import('../views/main-data/workstation/list.vue')
            }
        ]
    }, {
        path: "/production",
        name: "production",
        meta: {
            title: "生产管理",
        },
        icon: "<el-icon><Discount /></el-icon>",
        children: [
            {
                path: "/workorder",
                name: "workorder",
                meta: {
                    title: "生产工单",
                },
                component: () => import('../views/production/workorder/list.vue')
            },
            {
                path: "/processes",
                name: "processes",
                meta: {
                    title: "工序设置",
                },
                component: () => import('../views/production/processes/list.vue')
            },
            {
                path: "/workmanship",
                name: "workmanship",
                meta: {
                    title: "工艺流程",
                },
                component: () => import('../views/production/workmanship/list.vue')
            },
            {
                path: "/scheduling",
                name: "scheduling",
                meta: {
                    title: "生产排期",
                },
                component: () => import('../views/production/scheduling/list.vue')
            },
            {
                path: "/reporting",
                name: "reporting",
                meta: {
                    title: "生产报工",
                },
                component: () => import('../views/production/reporting/list.vue')
            }
        ]
    }, {
        path: "/quality",
        name: "quality",
        meta: {
            title: "质量管理",
        },
        icon: "",
        children: [
            {
                path: "/defect",
                name: "defect",
                meta: {
                    title: "常见缺陷",
                },
                component: () => import('../views/quality/defect/list.vue')
            }, {
                path: "/detection-item",
                name: "detection-item",
                meta: {
                    title: "检测项设置",
                },
                component: () => import('../views/quality/detection-item/list.vue')
            }, {
                path: "/detection-template",
                name: "detection-template",
                meta: {
                    title: "检测模版",
                },
                component: () => import('../views/quality/detection-template/list.vue')
            }, {
                path: "/detection-task",
                name: "detection-task",
                meta: {
                    title: "待检任务",
                },
                component: () => import('../views/quality/detection-task/list.vue')
            }, {
                path: "/incoming-detection",
                name: "incoming-detection",
                meta: {
                    title: "来料检测",
                },
                component: () => import('../views/quality/incoming-detection/list.vue')
            }, {
                path: "/process-detection",
                name: "process-detection",
                meta: {
                    title: "过程检测",
                },
                component: () => import('../views/quality/process-detection/list.vue')
            }, {
                path: "/shipping-detection",
                name: "shipping-detection",
                meta: {
                    title: "出货检测",
                },
                component: () => import('../views/quality/shipping-detection/list.vue')
            }
        ]
    }, {
        path: "/scheduling",
        name: "scheduling",
        meta: {
            title: "排班管理",
        },
        icon: "",
        children: [
            {
                path: "/scheduling-group",
                name: "scheduling-group",
                meta: {
                    title: "班组设置",
                },
                component: () => import('../views/scheduling/scheduling-group/list.vue')
            },
            {
                path: "/scheduling-plan",
                name: "scheduling-plan",
                meta: {
                    title: "排班计划",
                },
                component: () => import('../views/scheduling/scheduling-plan/list.vue')
            },
            {
                path: "/vacation",
                name: "vacation",
                meta: {
                    title: "节假日设置",
                },
                component: () => import('../views/scheduling/vacation/list.vue')
            },
            {
                path: "/scheduling-calendar",
                name: "scheduling-calendar",
                meta: {
                    title: "排版日历",
                },
                component: () => import('../views/scheduling/scheduling-calendar/list.vue')
            }
        ]
    }
]
// 创建路由对象
const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHistory(),
    routes, // `routes: routes` 的缩写
});
// 暴漏router对象
export default router;